home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
ldb.zip
/
BDRDEM2.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-18
|
1KB
|
58 lines
// bdrdem2.cpp
// Demo some stack, queue, list, array, and sort
// member functions.
// Link with binder.obj
#include <string.h>
#include <iomanip.h>
#include "binder.hpp"
main()
{
Binder B;
B.push("Now is the time");
B.atIns(B.Nodes(),"for all programmers");
B.insQ("to stop reinventing");
B.setCurNode(B.Nodes()-1);
B.ins("the linked list!");
cout << "\n\nBinder contains the following "
<< "nodes: \n\n";
for (B.setCurNode(); B++;
cout << (char *)(voiD) B << endl);
cout << "\n\nPress enter to continue ... ";
cin.get();
Binder B2;
B2.setComparE((BDRcomparE)strcmp);
while (B2.insSort(B++));
B.sort((BDRcomparE)strcmp);
cout << "\n\nAnd the Binder sorted:\n\n";
while (B.setCurNode(0))
cout << (char *) B.del() << endl;
cout << "\n\nAnd an alternate Binder "
"insertion sorted:\n\n";
while (B2.Nodes())
cout << (char *) B2.pop() << endl;
cout << "\n\nPress enter to quit ... ";
cin.get();
return 0;
}